解决 Mac下 Brew 更新缓慢的问题

  1. Mac 下 Brew 更新报错
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
==> Fetching /usr/local/Homebrew...
remote: Enumerating objects: 8643, done.
remote: Counting objects: 100% (8643/8643), done.
remote: Compressing objects: 100% (96/96), done.
fatal: the remote end hung up unexpectedly24 MiB | 15.00 KiB/s
fatal: early EOF
fatal: index-pack failed

==> Resetting /usr/local/Homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Reset branch 'master'
Your branch is up to date with 'origin/master'.

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
^C
  1. 报错原因及解决办法

切换到国内 Gitee 的镜像源。参考指令如下:

1
2
3
4
5
6
7
# 更新 brew
cd "$(brew --repo)"
git remote set-url origin https://gitee.com/brew-cn/brew.git

# 更新 homebrew-core
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://gitee.com/brew-cn/homebrew-core.git